﻿Imports System.Data
Imports System.Data.SqlClient

Public Class AlertaDatos

    Sub ingresarAlerta(ByVal pedido As String, ByVal usuario As String, ByVal mensaje As String)
        Dim conex As New Conexion
        Dim coneccion As SqlConnection = conex.conectar()
        coneccion.Open()
        Dim query As String = "Insert into ALER_Pedido(ALE_CodPedido,ALE_UsuarioEnv,ALE_UsuarioRec,ALE_FecIngreso,ALE_FecLectura,ALE_Descripcion) " &
                               "values(@codigo,@emisor,null,getDate(),null,@men)"
        Dim comando As New SqlCommand
        With comando
            .Connection = coneccion
            .CommandText = query
            .Parameters.AddWithValue("@codigo", pedido)
            .Parameters.AddWithValue("@emisor", usuario)
            .Parameters.AddWithValue("@men", mensaje)
            .ExecuteNonQuery()
        End With
        coneccion.Close()
    End Sub

End Class
